package com.valkyries.jhhj.service.impl;

import com.mybatisflex.core.query.QueryWrapper;
import com.valkyries.jhhj.domain.UserPermission;
import com.valkyries.jhhj.mapper.UserPermissionMapper;
import com.valkyries.jhhj.service.UserPermissionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

import static com.valkyries.jhhj.domain.table.Tables.USER_PERMISSION;

/**
 * 用户权限关联Service业务层处理
 */

@Service
public class UserPermissionServiceImpl implements UserPermissionService {
    @Autowired
    private UserPermissionMapper userPermissionMapper;


    /**
     * 查询用户id对应的所有权限
     */
    @Override
    public List<UserPermission> queryListByLoginId(Object loginId) {
        return userPermissionMapper.selectListByQuery(new QueryWrapper()
                .select(USER_PERMISSION.PERMISSION_ID)
                .where(USER_PERMISSION.USER_ID.eq(loginId)));
    }
}
